<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'territory.label', default: 'Territory')}"/>
    <title>区域管理 | 区域</title>
</head>

<body>
<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>区域</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item"><a href="#!">区域</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">
            <!-- Hover table card start -->
            <div class="card">
                <div class="card-header">
                    <h5>区域</h5>

                    <div class="card-header-right">
                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block dt-responsive">

                    <div class="table-responsive">
                        <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">

                            <g:form method="POST" action="searchTerritory">
                                <div class="row m-0">
                                    <div class="col-md-8 p-l-0">
                                        <div id="order-table_filter" class="dataTables_filter text-left">
                                            <label>搜索<input type="text" class="form-control" placeholder="区域名称"
                                                            name="name"
                                                            id="name"
                                                            value="${params?.name}">
                                            </label>
                                        </div>
                                    </div>
                                    <div class="col-md-4 p-r-0 dt-buttons text-right">
                                        <button class="btn btn-inverse btn-sm btn-squeare" type="submit"><i
                                                class="fa fa-search"></i>
                                        </button>
                                        <button class="btn btn-inverse btn-sm btn-squeare" type="button"
                                                id="resetBtn"><i
                                                class="fa fa-refresh"></i></button>
                                        <g:link action="create" class="btn btn-inverse btn-sm btn-squeare">
                                            <i class="icofont icofont-plus"></i>
                                        </g:link>

                                    </div>
                                </div>
                            </g:form>


                    <table class="table table-striped  table-bordered table-hover">
                        <thead>
                        <tr>
                            <g:sortableColumn property="name"
                                              title="${message(code: 'territory.name.label', default: '名称')}"/>
                            <g:sortableColumn property="account"
                                              title="${message(code: 'territory.account.label', default: '机构')}"/>
                            <g:sortableColumn property="product"
                                              title="${message(code: 'territory.product.label', default: '产品')}"/>
                                              <!-- <g:sortableColumn property="city"
                                                                title="${message(code: 'territory.city.label', default: '城市')}"/> -->
                            <g:sortableColumn property="workflow"
                                              title="${message(code: 'territory.workflow.label', default: '工作流')}"/>
                            <g:sortableColumn property="externalId"
                                              title="${message(code: 'territory.externalId.label', default: '外部ID')}"/>
                            <g:sortableColumn property="active"
                                              title="${message(code: 'territory.active.label', default: '启用')}"/>
                            <g:sortableColumn property="parent"
                                              title="${message(code: 'territory.parent.label', default: '区域')}"/>

                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${territoryList}">
                            <tr>
                                <td><g:link action="show" id="${it.id}" class="firstTd">${it.name}</g:link></td>
                                <td>
                                  ${it?.account}
                                </td>
                                <td>
                                  ${it?.product}
                                </td>

                                <td>
                                  ${it?.workflow}
                                </td>
                                <td>
                                  ${it?.externalId}
                                </td>
                                <td>
                                  ${it?.active}
                                </td>
                                <td>${it.parent}</td>

                            </tr>
                        </g:each>
                        </tbody>
                    </table>

                            <div class="dataTables_paginate">
                                <div class="pagination">
                                    <g:paginate total="${territoryCount ?: 0}" params="${params}"/>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>
            </div>
            <!-- Hover table card end -->
        </div>

        <!-- Page-body end -->

    </div>
</div>

</body>
</html>
